package com.ocom.company.dao;


import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.ocom.common.entity.human.EntityPersonnelInfo;
import com.ocom.common.vo.company.PersonCountVo;
import com.ocom.common.vo.company.PersonnelInfoVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface IDaoPersonnelInfo extends BaseMapper<EntityPersonnelInfo> {

//	select 	com_id as comId , count(id) 	as 	nowUserNum
//	from 	personnel_info
//	where 	status = 0
//	group by 	com_id

    @Select("select com_id as comId , count(p_id) as  nowUserNum   " +
            "from personnel_info " +
            "where status = 0 " +
            "group by com_id ")
    public List<PersonCountVo> selectPerCount();


    @Select("select P.p_tags as pTags,P.dept_id as deptId , D.dept_type as deptType,P.p_name as pName, D.dept_name as deptName from personnel_info P " +
            "left join dept_info D on D.dept_id = P.dept_id  ${ew.customSqlSegment}")
    List<PersonnelInfoVo> getPersonnelInfo(@Param(Constants.WRAPPER) Wrapper  wrapper);

}
